home *** CD-ROM | disk | FTP | other *** search
/ Tux Racer / Tux Racer.iso / program files / Sunspire Studios / Tux Racer / courses / course_idx.tcl
Encoding:
Text File  |  2001-12-13  |  17.3 KB  |  629 lines

  1.  
  2. #
  3. # Procedure to get course name, author, and par time from course.tcl file.
  4. #
  5. proc get_course_info { } {
  6.     if [catch {open course.tcl r} fileId] {
  7.     tux_warning "Couldn't open course.tcl in [pwd]"
  8.     return {}
  9.     }
  10.  
  11.     set name ""
  12.     set author ""
  13.     set par_time ""
  14.  
  15.     while {[gets $fileId line] >= 0} {
  16.     regexp {tux_course_name *([^;]*)} $line match name
  17.     regexp {tux_course_author *([^;]*)} $line match author
  18.     regexp {tux_par_time *([^;]*)} $line match par_time
  19.  
  20.     if { $author != "" && $name != "" && $par_time != "" } {
  21.         break;
  22.     }
  23.     }
  24.  
  25.     if { $author == "" } {
  26.     set author "Unknown"
  27.     }
  28.  
  29.     if { $name == "" } {
  30.     set name "Unknown"
  31.     }
  32.  
  33.     if { $par_time == "" } {
  34.         set par_time 120.0
  35.     } 
  36.  
  37.     eval "set name $name"
  38.     eval "set author $author"
  39.     eval "set par_time $par_time"
  40.  
  41.     return [list $name $author $par_time];
  42. }
  43.  
  44. set cwd [pwd]
  45. tux_goto_data_dir
  46.  
  47. tux_load_texture noicon textures/noicon.png 0
  48.  
  49. cd courses
  50.  
  51. tux_load_texture no_preview common/nopreview.png 0
  52. tux_bind_texture no_preview no_preview
  53.  
  54. #
  55. # Bind preview textures if they exist
  56. #
  57. foreach cup [glob -nocomplain *] {
  58.     if { $cup == "common" || $cup == "contrib" } {
  59.     continue;
  60.     }
  61.     if [file isdirectory $cup] {
  62.     foreach course [glob -nocomplain "$cup/*"] {
  63.         if [file exists "$course/preview.png"] {
  64.         set course [string tolower $course] ;# Assumes all course dirs are lower case
  65.         tux_load_texture $course "$course/preview.png" 0
  66.         tux_bind_texture $course $course
  67.         }
  68.     }
  69.     }
  70. }
  71.  
  72. set contrib_course_list {}
  73. set open_course_list {}
  74.  
  75. lappend open_course_list [ list  \
  76.     -course "beginner/beginner1" -name [ gs beginner1 ] \
  77.     -description [ gs beginner1_desc ] \
  78.     -par_time 100.0 ]
  79. lappend open_course_list [ list  \
  80.     -course "beginner/beginner2" -name [ gs beginner2 ] \
  81.     -description [ gs beginner2_desc ] \
  82.     -par_time 100.0 ]
  83. lappend open_course_list [ list  \
  84.     -course "beginner/beginner3" -name [ gs beginner3 ] \
  85.     -description [ gs beginner3_desc ] \
  86.     -par_time 100.0 ]
  87. lappend open_course_list [ list  \
  88.     -course "arctic/arctic1" -name [ gs arctic1 ] \
  89.     -description [ gs arctic1_desc ] \
  90.     -par_time 100.0 ]
  91. lappend open_course_list [ list  \
  92.     -course "arctic/arctic2" -name [ gs arctic2 ] \
  93.     -description [ gs arctic2_desc ] \
  94.     -par_time 150.0 ]
  95. lappend open_course_list [ list  \
  96.     -course "arctic/arctic3" -name [ gs arctic3 ] \
  97.     -description [ gs arctic3_desc ] \
  98.     -par_time 170.0 ]
  99. lappend open_course_list [ list  \
  100.     -course "forest/forest1" -name [ gs forest1 ] \
  101.     -description [ gs forest1_desc ] \
  102.     -par_time 100.0 ]
  103. lappend open_course_list [ list  \
  104.     -course "forest/forest2" -name [ gs forest2 ] \
  105.     -description [ gs forest2_desc ] \
  106.     -par_time 200.0 ]
  107. lappend open_course_list [ list  \
  108.     -course "forest/forest3" -name [ gs forest3 ] \
  109.     -description [ gs forest3_desc ] \
  110.     -par_time 200.0 ]
  111. lappend open_course_list [ list  \
  112.     -course "mountain/mountain1" -name [ gs mountain1 ] \
  113.     -description [ gs mountain1_desc ] \
  114.     -par_time 300.0 ]
  115. lappend open_course_list [ list  \
  116.     -course "mountain/mountain2" -name [ gs mountain2 ] \
  117.     -description [ gs mountain2_desc ] \
  118.     -par_time 300.0 ]
  119. lappend open_course_list [ list  \
  120.     -course "mountain/mountain3" -name [ gs mountain3 ] \
  121.     -description [ gs mountain3_desc ] \
  122.     -par_time 300.0 ]
  123. lappend open_course_list [ list  \
  124.     -course "glacier/glacier1" -name [ gs glacier1] \
  125.     -description [ gs glacier1_desc ] \
  126.     -par_time 160.0 ]
  127. lappend open_course_list [ list  \
  128.     -course "glacier/glacier2" -name [ gs glacier2] \
  129.     -description [ gs glacier2_desc ] \
  130.     -par_time 165.0 ]
  131. lappend open_course_list [ list  \
  132.     -course "glacier/glacier3" -name [ gs glacier3] \
  133.     -description [ gs glacier3_desc ] \
  134.     -par_time 150.0 ]
  135. lappend open_course_list [ list  \
  136.     -course "swiss/swiss1" -name [ gs swiss1 ] \
  137.     -description [ gs swiss1_desc ] \
  138.     -par_time 100.0 ]
  139. lappend open_course_list [ list  \
  140.     -course "swiss/swiss3" -name [ gs swiss3 ] \
  141.     -description [ gs swiss3_desc ] \
  142.     -par_time 100.0 ]
  143. lappend open_course_list [ list  \
  144.     -course "swiss/swiss2" -name [ gs swiss2 ] \
  145.     -description [ gs swiss2_desc ] \
  146.     -par_time 100.0 ]
  147.  
  148. tux_open_courses [concat $open_course_list $contrib_course_list ]
  149.  
  150. tux_load_texture herring_run_icon common/herringrunicon.png 0
  151. tux_load_texture cup_icon common/cupicon.png 0
  152.  
  153. tux_events [ list \
  154.     [ list \
  155.     -name [ gs solo_challenge ] -icon herring_run_icon -cups [ list \
  156.        [ list \
  157.           -name [ gs beginner_cup ] -icon cup_icon -races [ list \
  158.         [ list \
  159.             -course beginner/beginner1 \
  160.             -name [ gs beginner1 ] \
  161.             -description [ gs beginner1_desc ] \
  162.             -herring { 16 24 25 } \
  163.             -time { 75 58 53.5 } \
  164.             -par_time 75.0 \
  165.             -score { 0 0 0 } \
  166.             -mirrored no -conditions sunny \
  167.             -windy no -snowing no
  168.             ] \
  169.             [ list \
  170.         -course beginner/beginner2 \
  171.                 -name [ gs beginner2 ] \
  172.                 -description [ gs beginner2_desc ] \
  173.                 -herring { 20 30 31 } \
  174.                 -time { 75 55 51.5 } \
  175.             -par_time 75.0 \
  176.                 -score { 0 0 0 } \
  177.                 -mirrored no -conditions cloudy \
  178.                 -windy no -snowing no
  179.             ] \
  180.         [ list \
  181.             -course beginner/beginner3 \
  182.             -name [ gs beginner3 ] \
  183.             -description [ gs beginner3_desc ] \
  184.             -herring { 18 23 24 } \
  185.             -time { 75 57 52 } \
  186.             -par_time 75.0 \
  187.             -score { 0 0 0 } \
  188.             -mirrored no -conditions sunny \
  189.             -windy no -snowing yes
  190.             ] 
  191.       ]     
  192.           ] \
  193.           [ list \
  194.       -name [ gs arctic_cup ] -icon cup_icon -races [ list \
  195.         [ list \
  196.         -course arctic/arctic1 \
  197.         -name [ gs arctic1 ] \
  198.         -description [ gs arctic1_desc ] \
  199.         -herring { 25 36 41 } \
  200.         -time { 140 120 116  } \
  201.         -par_time 140.0 \
  202.         -score { 0 0 0 } \
  203.         -mirrored no -conditions sunny \
  204.         -windy no -snowing yes
  205.             ] \
  206.             [ list \
  207.         -course arctic/arctic2 \
  208.         -name [ gs arctic2 ] \
  209.         -description [ gs arctic2_desc ] \
  210.         -herring { 35 56 68 } \
  211.         -time { 165 144 140  } \
  212.         -par_time 165.0 \
  213.         -score { 0 0 0 } \
  214.         -mirrored no -conditions sunny \
  215.         -windy no -snowing no
  216.             ] \
  217.             [ list \
  218.         -course arctic/arctic3 \
  219.         -name [ gs arctic3 ] \
  220.         -description [ gs arctic3_desc ] \
  221.         -herring { 35 50 52 } \
  222.         -time { 160 137 123  } \
  223.         -par_time 160.0 \
  224.         -score { 0 0 0 } \
  225.         -mirrored no -conditions night \
  226.         -windy no -snowing no
  227.             ] 
  228.       ]     
  229.       ] \
  230.       [ list \
  231.           -name [ gs forest_cup ] -icon cup_icon -races [ list \
  232.         [ list \
  233.             -course forest/forest1 \
  234.         -name [ gs forest1 ] \
  235.         -description [ gs forest1_desc ] \
  236.         -herring { 25 36 40 } \
  237.         -time { 145 120 115 } \
  238.         -par_time 145.0 \
  239.         -score { 0 0 0 } \
  240.         -mirrored no -conditions night \
  241.         -windy no -snowing no
  242.             ] \
  243.         [ list \
  244.         -course forest/forest2 \
  245.         -name [ gs forest2 ] \
  246.         -description [ gs forest2_desc ] \
  247.         -herring { 52 64 70 } \
  248.         -time { 165 140 125 } \
  249.         -par_time 165.0 \
  250.         -score { 0 0 0 } \
  251.         -mirrored no -conditions cloudy \
  252.         -windy no -snowing no
  253.         ] \
  254.         [ list \
  255.         -course forest/forest3 \
  256.         -name [ gs forest3 ] \
  257.         -description [ gs forest3_desc ] \
  258.         -herring { 18 28 32 } \
  259.         -time { 150 130 127 } \
  260.         -par_time 150.0 \
  261.         -score { 0 0 0 } \
  262.         -mirrored no -conditions sunny \
  263.         -windy no -snowing no
  264.             ]
  265.       ] 
  266.       ] \
  267.       [ list \
  268.           -name [ gs mountain_cup ] -icon cup_icon -races [ list \
  269.         [ list \
  270.         -course mountain/mountain1 \
  271.         -name [ gs mountain1 ] \
  272.         -description [ gs mountain1_desc ] \
  273.         -herring { 30 38 35 } \
  274.         -time { 190 164 145 } \
  275.         -par_time 190.0 \
  276.         -score { 0 0 0 } \
  277.         -mirrored no -conditions sunny \
  278.         -windy no -snowing no
  279.             ] \
  280.         [ list \
  281.         -course mountain/mountain2 \
  282.         -name [ gs mountain2 ] \
  283.         -description [ gs mountain2_desc ] \
  284.         -herring { 40 56 60 } \
  285.         -time { 185 165 155 } \
  286.         -par_time 185.0 \
  287.         -score { 0 0 0 } \
  288.         -mirrored no -conditions night \
  289.         -windy no -snowing yes
  290.             ] \
  291.         [ list \
  292.         -course mountain/mountain3 \
  293.         -name [ gs mountain3 ] \
  294.         -description [ gs mountain3_desc ] \
  295.         -herring { 40 50 56 } \
  296.         -time { 210 192 187 } \
  297.         -par_time 210.0 \
  298.         -score { 0 0 0 } \
  299.         -mirrored no -conditions cloudy \
  300.         -windy no -snowing no
  301.             ]
  302.       ]
  303.       ] \
  304.       [ list \
  305.           -name [ gs glacier_cup ] -icon cup_icon -races [ list \
  306.         [ list \
  307.         -course glacier/glacier1 \
  308.         -name [ gs glacier1 ] \
  309.         -description [ gs glacier1_desc ] \
  310.         -herring { 30 38 44 } \
  311.         -time { 160 139 135 } \
  312.         -par_time 160.0 \
  313.         -score { 0 0 0 } \
  314.         -mirrored no -conditions sunny \
  315.         -windy no -snowing yes
  316.             ] \
  317.         [ list \
  318.         -course glacier/glacier2 \
  319.         -name [ gs glacier2 ] \
  320.         -description [ gs glacier2_desc ] \
  321.         -herring { 28 33 35 } \
  322.         -time { 150 132 127 } \
  323.         -par_time 150.0 \
  324.         -score { 0 0 0 } \
  325.         -mirrored no -conditions night \
  326.         -windy no -snowing no
  327.             ] \
  328.         [ list \
  329.         -course glacier/glacier3 \
  330.         -name [ gs glacier3 ] \
  331.         -description [ gs glacier3_desc ] \
  332.         -herring { 25 32 35 } \
  333.         -time { 155 136 132 } \
  334.         -par_time 155.0 \
  335.         -score { 0 0 0 } \
  336.         -mirrored no -conditions sunny \
  337.         -windy no -snowing no
  338.             ]
  339.       ]
  340.       ] \
  341.       [ list \
  342.           -name [ gs swiss_cup ] -icon cup_icon -races [ list \
  343.         [ list \
  344.         -course swiss/swiss1 \
  345.         -name [ gs swiss1 ] \
  346.         -description [ gs swiss1_desc ] \
  347.         -herring { 60 70 72 } \
  348.         -time { 190 168 162 } \
  349.         -par_time 190.0 \
  350.         -score { 0 0 0 } \
  351.         -mirrored no -conditions sunny \
  352.         -windy no -snowing no
  353.             ] \
  354.         [ list \
  355.         -course swiss/swiss3 \
  356.         -name [ gs swiss3 ] \
  357.         -description [ gs swiss3_desc ] \
  358.         -herring { 28 40 44 } \
  359.         -time { 190 168 160 } \
  360.         -par_time 190.0 \
  361.         -score { 0 0 0 } \
  362.         -mirrored no -conditions cloudy \
  363.         -windy no -snowing yes
  364.             ] \
  365.         [ list \
  366.         -course swiss/swiss2 \
  367.         -name [ gs swiss2 ] \
  368.         -description [ gs swiss2_desc ] \
  369.         -herring { 40 45 50 } \
  370.         -time { 165 150 146 } \
  371.         -par_time 165.0 \
  372.         -score { 0 0 0 } \
  373.         -mirrored no -conditions night \
  374.         -windy no -snowing no
  375.             ] 
  376.       ]
  377.       ]
  378.     ]
  379.       ] \
  380.       [ list \
  381.       -name [ gs race_vs_opponents ] -icon herring_run_icon -cups [ list \
  382.        [ list \
  383.           -name [ gs beginner_cup ] -icon cup_icon -races [ list \
  384.         [ list \
  385.             -course beginner/beginner1 \
  386.             -name [ gs beginner1 ] \
  387.             -description [ gs beginner1_desc ] \
  388.             -herring { 0 0 0 } \
  389.             -time { 0 0 0 } \
  390.             -par_time 75.0 \
  391.             -score { 0 0 0 } \
  392.             -opponents { 1 1 1 } \
  393.             -mirrored no -conditions sunny \
  394.             -windy no -snowing no
  395.             ] \
  396.             [ list \
  397.         -course beginner/beginner2 \
  398.                 -name [ gs beginner2 ] \
  399.                 -description [ gs beginner2_desc ] \
  400.                 -herring { 0 0 0 } \
  401.                 -time { 0 0 0 } \
  402.             -par_time 75.0 \
  403.                 -score { 0 0 0 } \
  404.             -opponents { 1 1 1 } \
  405.                 -mirrored no -conditions cloudy \
  406.                 -windy no -snowing no
  407.             ] \
  408.         [ list \
  409.             -course beginner/beginner3 \
  410.             -name [ gs beginner3 ] \
  411.             -description [ gs beginner3_desc ] \
  412.             -herring { 0 0 0 } \
  413.             -time { 0 0 0 } \
  414.             -par_time 75.0 \
  415.             -score { 0 0 0 } \
  416.             -opponents { 1 1 1 } \
  417.             -mirrored no -conditions sunny \
  418.             -windy no -snowing yes
  419.             ] 
  420.       ]     
  421.           ] \
  422.           [ list \
  423.       -name [ gs arctic_cup ] -icon cup_icon -races [ list \
  424.         [ list \
  425.         -course arctic/arctic1 \
  426.         -name [ gs arctic1 ] \
  427.         -description [ gs arctic1_desc ] \
  428.         -herring { 0 0 0 } \
  429.         -time { 0 0 0 } \
  430.         -par_time 120.0 \
  431.         -score { 0 0 0 } \
  432.         -opponents { 1 1 1 } \
  433.         -mirrored no -conditions sunny \
  434.         -windy no -snowing yes
  435.             ] \
  436.             [ list \
  437.         -course arctic/arctic2 \
  438.         -name [ gs arctic2 ] \
  439.         -description [ gs arctic2_desc ] \
  440.         -herring { 0 0 0 } \
  441.         -time { 0 0 0 } \
  442.         -par_time 165.0 \
  443.         -score { 0 0 0 } \
  444.         -opponents { 1 1 1 } \
  445.         -mirrored no -conditions sunny \
  446.         -windy no -snowing no
  447.             ] \
  448.             [ list \
  449.         -course arctic/arctic3 \
  450.         -name [ gs arctic3 ] \
  451.         -description [ gs arctic3_desc ] \
  452.         -herring { 0 0 0 } \
  453.         -time { 0 0 0 } \
  454.         -par_time 160.0 \
  455.         -score { 0 0 0 } \
  456.         -opponents { 1 1 1 } \
  457.         -mirrored no -conditions night \
  458.         -windy no -snowing no
  459.             ] 
  460.       ]     
  461.       ] \
  462.       [ list \
  463.           -name [ gs forest_cup ] -icon cup_icon -races [ list \
  464.         [ list \
  465.             -course forest/forest1 \
  466.         -name [ gs forest1 ] \
  467.         -description [ gs forest1_desc ] \
  468.         -herring { 0 0 0 } \
  469.         -time { 0 0 0 } \
  470.         -par_time 145.0 \
  471.         -score { 0 0 0 } \
  472.         -opponents { 1 1 1 } \
  473.         -mirrored no -conditions night \
  474.         -windy no -snowing no
  475.             ] \
  476.         [ list \
  477.         -course forest/forest2 \
  478.         -name [ gs forest2 ] \
  479.         -description [ gs forest2_desc ] \
  480.         -herring { 0 0 0 } \
  481.         -time { 0 0 0 } \
  482.         -par_time 165.0 \
  483.         -score { 0 0 0 } \
  484.         -opponents { 1 1 1 } \
  485.         -mirrored no -conditions cloudy \
  486.         -windy no -snowing no
  487.         ] \
  488.         [ list \
  489.         -course forest/forest3 \
  490.         -name [ gs forest3 ] \
  491.         -description [ gs forest3_desc ] \
  492.         -herring { 0 0 0 } \
  493.         -time { 0 0 0 } \
  494.         -par_time 150.0 \
  495.         -score { 0 0 0 } \
  496.         -opponents { 1 1 1 } \
  497.         -mirrored no -conditions sunny \
  498.         -windy no -snowing no
  499.             ]
  500.       ] 
  501.       ] \
  502.       [ list \
  503.           -name [ gs mountain_cup ] -icon cup_icon -races [ list \
  504.         [ list \
  505.         -course mountain/mountain1 \
  506.         -name [ gs mountain1 ] \
  507.         -description [ gs mountain1_desc ] \
  508.         -herring { 0 0 0 } \
  509.         -time { 0 0 0 } \
  510.         -par_time 190.0 \
  511.         -score { 0 0 0 } \
  512.         -opponents { 1 1 1 } \
  513.         -mirrored no -conditions sunny \
  514.         -windy no -snowing no
  515.             ] \
  516.         [ list \
  517.         -course mountain/mountain2 \
  518.         -name [ gs mountain2 ] \
  519.         -description [ gs mountain2_desc ] \
  520.         -herring { 0 0 0 } \
  521.         -time { 0 0 0 } \
  522.         -par_time 185.0 \
  523.         -score { 0 0 0 } \
  524.         -opponents { 1 1 1 } \
  525.         -mirrored no -conditions night \
  526.         -windy no -snowing yes
  527.             ] \
  528.         [ list \
  529.         -course mountain/mountain3 \
  530.         -name [ gs mountain3 ] \
  531.         -description [ gs mountain3_desc ] \
  532.         -herring { 50 55 60 } \
  533.         -time { 255 210 195 } \
  534.         -par_time 210.0 \
  535.         -score { 0 0 0 } \
  536.         -opponents { 1 1 1 } \
  537.         -mirrored no -conditions cloudy \
  538.         -windy no -snowing no
  539.             ]
  540.       ]
  541.       ] \
  542.       [ list \
  543.           -name [ gs glacier_cup ] -icon cup_icon -races [ list \
  544.         [ list \
  545.         -course glacier/glacier1 \
  546.         -name [ gs glacier1 ] \
  547.         -description [ gs glacier1_desc ] \
  548.         -herring { 30 35 40 } \
  549.         -time { 180 165 150 } \
  550.         -par_time 160.0 \
  551.         -score { 0 0 0 } \
  552.         -opponents { 1 1 1 } \
  553.         -mirrored no -conditions sunny \
  554.         -windy no -snowing yes
  555.             ] \
  556.         [ list \
  557.         -course glacier/glacier2 \
  558.         -name [ gs glacier2 ] \
  559.         -description [ gs glacier2_desc ] \
  560.         -herring { 20 25 30 } \
  561.         -time { 180 165 135 } \
  562.         -par_time 150.0 \
  563.         -score { 0 0 0 } \
  564.         -opponents { 1 1 1 } \
  565.         -mirrored no -conditions night \
  566.         -windy no -snowing no
  567.             ] \
  568.         [ list \
  569.         -course glacier/glacier3 \
  570.         -name [ gs glacier3 ] \
  571.         -description [ gs glacier3_desc ] \
  572.         -herring { 20 25 30 } \
  573.         -time { 180 150 135 } \
  574.         -par_time 155.0 \
  575.         -score { 0 0 0 } \
  576.         -opponents { 1 1 1 } \
  577.         -mirrored no -conditions sunny \
  578.         -windy no -snowing no
  579.             ]
  580.       ]
  581.       ] \
  582.       [ list \
  583.           -name [ gs swiss_cup ] -icon cup_icon -races [ list \
  584.         [ list \
  585.         -course swiss/swiss1 \
  586.         -name [ gs swiss1 ] \
  587.         -description [ gs swiss1_desc ] \
  588.         -herring { 40 50 60 } \
  589.         -time { 240 200 180 } \
  590.         -par_time 190.0 \
  591.         -score { 0 0 0 } \
  592.         -opponents { 1 1 1 } \
  593.         -mirrored no -conditions sunny \
  594.         -windy no -snowing no
  595.             ] \
  596.         [ list \
  597.         -course swiss/swiss3 \
  598.         -name [ gs swiss3 ] \
  599.         -description [ gs swiss3_desc ] \
  600.         -herring { 25 30 35 } \
  601.         -time { 180 165 150 } \
  602.         -par_time 190.0 \
  603.         -score { 0 0 0 } \
  604.         -opponents { 1 1 1 } \
  605.         -mirrored no -conditions cloudy \
  606.         -windy no -snowing yes
  607.             ] \
  608.         [ list \
  609.         -course swiss/swiss2 \
  610.         -name [ gs swiss2 ] \
  611.         -description [ gs swiss2_desc ] \
  612.         -herring { 30 45 55 } \
  613.         -time { 200 180 165 } \
  614.         -par_time 165.0 \
  615.         -score { 0 0 0 } \
  616.         -opponents { 1 1 1 } \
  617.         -mirrored no -conditions night \
  618.         -windy no -snowing no
  619.             ] 
  620.       ]
  621.       ]
  622.      ]
  623.    ]  
  624. ]
  625.     
  626.  
  627. cd $cwd
  628.  
  629.